

package com.kw.common.ocr;


import com.kw.common.ocr.service.AliyumOcrTemplate;
import com.kw.common.ocr.service.OcrTemplate;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;


@AllArgsConstructor
@EnableConfigurationProperties({ OcrProperties.class })
public class OcrAutoConfiguration {

	private final OcrProperties properties;

	@Bean
	@ConditionalOnMissingBean(OcrTemplate.class)
	@ConditionalOnProperty(name = "ocr.enable", havingValue = "true", matchIfMissing = true)
	public OcrTemplate ocrTemplate() {
		return new AliyumOcrTemplate(properties);
	}



}
